package com.yusvn.scm.goods.fenhuo.controller;

import com.jfinal.aop.Inject;
import com.jfinal.kit.Kv;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import com.yusvn.scm.common.BaseController;
import com.yusvn.scm.common.kit.RetKit;
import com.yusvn.scm.goods.fenhuo.service.ScmFenhuoPifaXianhuoService;


/**
 * 批发分货 --期货
 * @author liugz
 *
 */
public class ScmFenhuoPifaXianhuoController extends BaseController {

	@Inject
	ScmFenhuoPifaXianhuoService srv;
	
	public void index() {
		renderJson();
	}
	
	// 批发现货分货 - 分页查询销售单
	public void pifaXianhuoXxd() {
		Kv kv = jsonStrToKv(getRawData());
		if(kv.isEmpty()) {
			kv = getKv();
		}
		// 获取当前登录用户
		kv.set("userid", getLoginUserId());
		
		Page<Record> recPage = srv.pifaXianhuoXxd(kv);
		renderJson(RetKit.ok().setData( recPage.getList() ).setCount(recPage.getTotalRow()) );
	}
	
	// 批发现货分货 - 审核结果
	public void pifaXianhuoDjsh() {
		Kv kv = jsonStrToKv(getRawData());
		if(kv.isEmpty()) {
			kv = getKv();
		}
		// 获取当前登录用户
		kv.set("userid", getLoginUserId());
		
		renderJson(srv.pifaXianhuoDjsh(kv) );
	}
	

	// 批发现货分货 - 刷新价格
	public void pifaXianhuoSxjg() {
		Kv kv = jsonStrToKv(getRawData());
		if(kv.isEmpty()) {
			kv = getKv();
		}
		// 获取当前登录用户
		kv.set("userid", getLoginUserId());
		
		renderJson(srv.pifaXianhuoSxjg(kv) );
	}
	
}
